From: Euan Harris Date: Mon, 1 Dec 2014 14:27:06 +0000 (+0000) Subject: libxl: Don't dereference null new_name pointer in libxl_domain_rename() X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~4041 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks://%22/%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22?a=commitdiff_plain;h=276ba7806259c10b186c9cd9115078fb35b28bc7;p=xen.git libxl: Don't dereference null new_name pointer in libxl_domain_rename() libxl__domain_rename() unconditionally dereferences its new_name parameter, to check whether it is an empty string. Add a check to avoid a segfault if new_name is null. Signed-off-by: Euan Harris Acked-by: Ian Campbell --- diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index c50c323376..74c00dc414 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -385,6 +385,13 @@ int libxl__domain_rename(libxl__gc *gc, uint32_t domid, } } + if (!new_name) { + LIBXL__LOG(ctx, LIBXL__LOG_ERROR, + "new domain name not specified"); + rc = ERROR_INVAL; + goto x_rc; + } + if (new_name[0]) { /* nonempty names must be unique */ uint32_t domid_e;